// ignore_for_file: file_names

import 'package:flutter/material.dart';

class StateControlView extends StatefulWidget {
  const StateControlView({super.key});

  @override
  State createState() => _StateControlView();
}

class _StateControlView extends State<StateControlView> {
  int count = 0;
  @override
  Widget build(BuildContext context) {
    return Column(
      children: [
        const Text('有状态组件'),
        Row(
          children: [
            FloatingActionButton(
              onPressed: () {
                if (count > 0) {
                  setState(() {
                    count--;
                  });
                }
              },
              child: const Icon(Icons.minimize_outlined),
            ),
            Text(count.toString()),
            FloatingActionButton(
              onPressed: () {
                setState(() {
                  count++;
                });
              },
              child: const Icon(Icons.add),
            )
          ],
        )
      ],
    );
  }
}
